﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ocmf.Forms
{
    public partial class ExperimentNameForm : Form
    {

        public string ExperimentName { get; set; }
        public string[] ExistingExperimentNames { get; set; }

        public ExperimentNameForm(string experimentName)
        {
            InitializeComponent();
            experimentNameTextBox.Text = experimentName;
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            if (ExistingExperimentNames != null)
                for (var i = 0; i < ExistingExperimentNames.Length; i++)
                    if (ExistingExperimentNames[i] == experimentNameTextBox.Text)
                    {
                        MessageBox.Show("Experiment name must be unique.");
                        return;
                    }

            ExperimentName = experimentNameTextBox.Text;
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }
    }
}
